package com.denso.workflow.admin.image;

import com.denso.workflow.common.model.Image;

import java.util.List;

/**
 * Created by lijian on 2018/9/22.
 */
public class ImageService {
    private static final Image dao = new Image();

    public List<Image> findAll() {
        List<Image> imageList = dao.find("select * from image order by id desc");
        return imageList;
    }

    public List<Image> findByCode(String code) {
        List<Image> imageList = dao.find("select * from image where code=?", code);
        return imageList;
    }

    public boolean savePcode(int id, int pcodeBegin, int pcodeEnd) {
        Image image = dao.findById(id);
        image.setPcodeBegin(pcodeBegin);
        image.setPcodeEnd(pcodeEnd);
        return image.update();
    }



    public Image findById(int id) {
        return dao.findById(id);
    }

    public boolean deleteById(int id) {
        return dao.deleteById(id);
    }

    public boolean save(Image image) {
        return image.save();
    }
}
